<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
     class Animal {
        constructor(name, age){
          this.name = name
          this.age = age
        }
        sayHello(){
          console.log(`${this.name}在打招呼`)
        }
     }

     class Person extends Animal {
        constructor(name, age, sex){
          super(name, age)
          this.sex = sex
        }
        eat(){
          console.log(`${this.name}在吃饭`)
        }
     }

     const p1 = new Person('张三', 18, '男')
     console.log(p1)
     p1.sayHello()
     p1.eat()

    //  const a1 = new Animal('小猫', 3)
    //  console.log(a1)
    //  a1.sayHello()
  </script>
</body>
</html>